VERSION 5.00
Begin VB.UserControl MenuWindows7 
   ClientHeight    =   5850
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   5100
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   HasDC           =   0   'False
   InvisibleAtRuntime=   -1  'True
   KeyPreview      =   -1  'True
   ScaleHeight     =   390
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   340
   Begin VB.Label Label1 
      Caption         =   "Themes : Menu"
      Height          =   450
      Left            =   30
      TabIndex        =   0
      Top             =   30
      Width           =   735
   End
End
Attribute VB_Name = "MenuWindows7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type

Private Enum StateControlDQH
   hNormal = 1
   hHotting = 2
   hPressed = 3
   hDisabled = 4
   hForcus = 5
End Enum

Const DT_EXPANDTABS = &H40
Const DT_CENTER = &H1

Dim m As New GraphicsTools
'Default Property Values:
Const m_def_Color = vbButtonFace
Const m_def_Enabled = 0
'Property Variables:
Dim m_Font As Font
Dim m_Color As OLE_COLOR
Dim m_Enabled As Boolean

Public Sub ThemeMenus(hWnd As Long, lHDC As Long, plDraw As Integer, State As Integer, mnLeft As Long, mnTop As Long, mnRight As Long, mnBottom As Variant)
   Dim mRECT As RECT
   On Error Resume Next
   With mRECT
     .Left = mnLeft
     .Top = mnTop
     .Right = mnRight
     .Bottom = mnBottom
   End With
   
   Select Case plDraw
      Case 0
         'Draw Menu Bar
         If State = 0 Then
         '   Ve Nen cua Bar
           m.DrawGradient lHDC, mRECT.Left, mRECT.Top, mRECT.Right, (mRECT.Bottom - mRECT.Top) / 2 + mRECT.Top, m.TranslateColors(&HFFFEFE), m.TranslateColors(&HF5EAE5), True
           m.DrawGradient lHDC, mRECT.Left, (mRECT.Bottom - mRECT.Top) / 2 + mRECT.Top, mRECT.Right, mRECT.Bottom, m.TranslateColors(&HEBD7CF), m.TranslateColors(&HFDF0EE), True
         ElseIf State = 1 Then
         '   Ve nen cua Menu
           m.DrawGradient lHDC, mRECT.Left, mRECT.Top, mRECT.Right, (mRECT.Bottom - mRECT.Top) / 2 + mRECT.Top, m.TranslateColors(&HFFFEFE), m.TranslateColors(&HF5EAE5), True
           m.DrawGradient lHDC, mRECT.Left, (mRECT.Bottom - mRECT.Top) / 2 + mRECT.Top, mRECT.Right, mRECT.Bottom, m.TranslateColors(&HEBD7CF), m.TranslateColors(&HFDF0EE), True
         End If
      Case 1
         'Draw TopMenu Selected
         If State = 0 Then
            'Top Menu Select
            m.DrawFill lHDC, mRECT.Left, mRECT.Top, CSng(mRECT.Right), CSng(mRECT.Bottom), &HD0CAC8
            m.DrawRoundSquare lHDC, mRECT.Left + 2, mRECT.Top + 2, CSng(mRECT.Right), CSng(mRECT.Bottom), m.TranslateColors(&HCFBFB9)
            m.DrawRoundSquare lHDC, mRECT.Left + 1, mRECT.Top + 1, CSng(mRECT.Right), CSng(mRECT.Bottom), m.TranslateColors(&HB4A9A4)
            m.DrawRoundSquare lHDC, mRECT.Left, mRECT.Top, CSng(mRECT.Right), CSng(mRECT.Bottom), m.TranslateColors(&H534D4B)
         ElseIf State = 1 Then
            'Top Menu Hottrack
            m.DrawRoundSquare lHDC, mRECT.Left + 1, mRECT.Top + 1, CSng(mRECT.Right) - 1, CSng(mRECT.Bottom) - 1, vbWhite
            m.DrawRoundSquare lHDC, mRECT.Left, mRECT.Top, CSng(mRECT.Right), CSng(mRECT.Bottom), m.TranslateColors(&HA89B96)
         End If
      Case 2
         If State = 0 Then
            'Draw Back Left PopUp Menu
            m.DrawFill lHDC, mRECT.Left + 1, mRECT.Top, mRECT.Right, mRECT.Bottom, m.TranslateColors(&HF1F1F1)
         ElseIf State = 1 Then
            'Draw Backgroup
            m.DrawFill lHDC, mRECT.Left, mRECT.Top, mRECT.Right, mRECT.Bottom, m.TranslateColors(&HF0F0F0)
            m.DrawLine lHDC, mRECT.Left, mRECT.Top, mRECT.Left, mRECT.Bottom, vbWhite
            m.DrawLine lHDC, mRECT.Left - 1, mRECT.Top, mRECT.Left - 1, mRECT.Bottom, m.TranslateColors(&HE3E3E2)
         End If
      Case 3
         'Draw Separator
         m.DrawFill lHDC, mRECT.Left, mRECT.Top, mRECT.Right, mRECT.Bottom, m.TranslateColors(vbButtonShadow)
      Case 4
         ' Draw Menu Item
         If State = 0 Then
            'Draw Menu
            m.DrawGradient lHDC, mRECT.Left + 1, mRECT.Top + 1, mRECT.Right - 1, mRECT.Bottom - 1, m.TranslateColors(&HF6F4F2), m.TranslateColors(&HF6EDE6), True
            m.DrawRoundSquare lHDC, mRECT.Left + 1, mRECT.Top + 1, mRECT.Right - 1, mRECT.Bottom - 1, vbWhite
            m.DrawRoundSquare lHDC, mRECT.Left, mRECT.Top, mRECT.Right, mRECT.Bottom, m.TranslateColors(&HF7CFAE)
         Else
            'Draw Menu Disabled
            'Nothing Draw !
         End If
      Case 5
         If State = 0 Then
            'Draw Check Disabled
            m.DrawFill lHDC, mRECT.Left, mRECT.Top, mRECT.Right, mRECT.Bottom, m.ColorToRGB(&HECECEC, 0, 0, 0, -15)
            m.DrawFrame lHDC, mRECT.Left, mRECT.Top, mRECT.Right, mRECT.Bottom, m.ColorToRGB(&HECECEC, , , , -40)
         ElseIf State = 1 Then
            'Draw Check Selected
            'Nothing Draw
         ElseIf State = 2 Then
            'Draw Check
            m.DrawFill lHDC, mRECT.Left, mRECT.Top, mRECT.Right, mRECT.Bottom, m.ColorToRGB(&HECECEC)
            m.DrawFrame lHDC, mRECT.Left, mRECT.Top, mRECT.Right, mRECT.Bottom, m.ColorToRGB(&HECECEC, , , , -20)
         End If
      Case 6
         'Draw Border Popup Menu
         m.DrawFill lHDC, mRECT.Left, mRECT.Top, mRECT.Right, mRECT.Bottom, m.TranslateColors(vbWhite)
         m.DrawFrame lHDC, mRECT.Left, mRECT.Top, mRECT.Right, mRECT.Bottom, m.TranslateColors(&HC0BCBE)
   End Select
End Sub

Private Sub UserControl_Resize()
  If Width <> 51 * Screen.TwipsPerPixelX Then
      Width = 51 * Screen.TwipsPerPixelX
  End If
  
  If Height <> 31 * Screen.TwipsPerPixelY Then
      Height = 31 * Screen.TwipsPerPixelY
  End If
End Sub
